﻿using System.Collections.Generic;

public class ArchiveQuery : Singleton<ArchiveQuery>
{
    private ArchiveModel model;
    private List<MaterialInfo> materialInfos;
    private List<CouponData> couponsDatas;
    private ArchiveQuery()
    {
        model = ModelContainer.Instance.GetModel<ArchiveModel>();
        materialInfos = model.GameData.materialDatas;
        couponsDatas = model.GameData.couponDatas;
    }
    public int GetMaterialNum(MaterialType type)
    {
        foreach (MaterialInfo info in materialInfos)
        {
            if (info.materialType == type)
            {
                return info.num;
            }
        }
        return 0;
    }
    public int GetCouponsNum(CouponsType type, QualityType quality)
    {
        foreach (CouponData data in couponsDatas)
        {
            if (data.CouponType == type && data.CouponQuality == quality)
            {
                return data.num;
            }
        }
        return 0;
    }
    public LanguageType GetLanguage()
    {
        return model.SysData.Language;
    }
}
